package com.qk.mapper;

import com.qk.entity.Course;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CourseMapper {
@Insert("insert into course(subject,name,price,target,description,create_time,update_time) values(#{subject},#{name},#{price},#{target},#{description},#{createTime},#{updateTime})")
    void insert(Course course);

    List<Course> selectList(Integer subject,String name,  Integer target);

@Select("select id, subject, name, price, target, description, create_time, update_time from course where id= #{id}")
    Course selectById(Integer id);

//@Update("update course set subject=#{subject},name=#{name},price=#{price},target=#{target},description=#{description},update_time=#{updateTime} where id=#{id}")
    void update(Course course);
@Delete( "delete from course where id= #{id}")
    void deleteById(Integer id);
@Select( "select id, subject, name, price, target, description, create_time, update_time from course ")
    List<Course> selectAll();
@Select( "select id, subject, name, price, target, description, create_time, update_time from course where subject= #{subject}")
    List<Course> selectBySubject(Integer subject);
}
